import http from "./utils/http"
import { modal } from "./utils/storage"
App({
  globalData: {
    status: { "0": "未激活", "1": "待审核", "2": "待发布", "3": "报名中", "4": "进行中", "5": "已结束" },
    shareApp: {
      title: "桂林信科素质素养服务平台",
      path: "/pages/index/index",
      imageUrl: "/images/xklogo.png"
    },
    TOKEN_NAME: "token",
    USER_NAME: "user"
  },
  onLaunch() {
    wx.$http = http;
    wx.$TOKEN_NAME = this.globalData.TOKEN_NAME;
    wx.$USER_NAME = this.globalData.USER_NAME;

    //冷启动异步版本检查更新
    const manager = wx.getUpdateManager();
    manager.onUpdateReady(async () => {
      await modal({ title: "新版本提示", content: "新版本已经准备好，即将重启应用", showCancel: false });
      manager.applyUpdate();
    })
  }
})
